package com.heu.lu;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Main {

	public static void main(String[] args) {
		Random random= new Random();
		Car car = new Car();
		car.x = random.nextDouble();
		car.y = random.nextDouble();
		int count = 6;
		ArrayList<Car> cars = new ArrayList<Car>(count);
		for (int i = 0; i < count; i++) {
			Car nearbyCar = new Car();
			nearbyCar.id = i;
			nearbyCar.x = random.nextDouble();
			nearbyCar.y = random.nextDouble();
			cars.add(nearbyCar);
		}
		
		car.nearbyCars = cars;
		
		List<Car> selectedCars = car.findNextNCars(5);
		for (Car c : selectedCars) {
			System.out.println("id: " + c.id + " distanse:" + Car.getDistanse(car.x, car.y, c.x, c.y));
		}
	}

}
